## setup

# clean environment
rm(list=ls())

# load packages
library(sandwich)
library(lmtest)

# load data
dat <- read.csv2("data_survey_csv.csv",
                 encoding = 'UTF-8')


## models

# column 1
mod_1 <- lm(credible~treatment, dat[grepl("michael", dat$treatment),])

# column 2
mod_2 <- lm(credible~treatment + female + age + east + migback_resp, dat[grepl("michael", dat$treatment),])

# column 3
mod_3 <- lm(appropriate~treatment, dat[grepl("michael", dat$treatment),])

# column 4
mod_4 <- lm(appropriate~treatment + female + age + east + migback_resp, dat[grepl("michael", dat$treatment),])

# column 5
mod_5 <- lm(imaginable~treatment, dat[grepl("michael", dat$treatment),])

# column 6
mod_6 <- lm(imaginable~treatment + female + age + east + migback_resp, dat[grepl("michael", dat$treatment),])


## robust standard errors

# column 1
mod_1_rob <- coeftest(mod_1, vcov = vcovHC(mod_1, "HC1"))

# column 2
mod_2_rob <- coeftest(mod_2, vcov = vcovHC(mod_2, "HC1"))

# column 3
mod_3_rob <- coeftest(mod_3, vcov = vcovHC(mod_3, "HC1"))

# column 4
mod_4_rob <- coeftest(mod_4, vcov = vcovHC(mod_4, "HC1"))

# column 4
mod_5_rob <- coeftest(mod_5, vcov = vcovHC(mod_5, "HC1"))

# column 4
mod_6_rob <- coeftest(mod_6, vcov = vcovHC(mod_6, "HC1"))


## show coefficients and standard errors
mod_1_rob
mod_2_rob
mod_3_rob
mod_4_rob
mod_5_rob
mod_6_rob

